#include <iostream>

#include "matrix_thread.h"
#include <vector>
using namespace std;



int main(){
    static const int MATRIX_SIZE = 3;
    vector<MatrixThread*> threads;

    double A_fila1[MATRIX_SIZE]={1, 2, 3};
    double A_fila2[MATRIX_SIZE]={3, 2, 3};
    double A_fila3[MATRIX_SIZE]={0, 2, 5};

    double B_columna1[MATRIX_SIZE]={3, 2, 0};
    double B_columna2[MATRIX_SIZE]={6, 5, 1};
    double B_columna3[MATRIX_SIZE]={1, 4, 5};

    double* matrizA[MATRIX_SIZE] = {A_fila1, A_fila2, A_fila3};
    double* matrizB[MATRIX_SIZE] = {B_columna1, B_columna3, B_columna3};

    vector<MatrixThread::RowCol*> datavector;


    for (int i=0;i<3;i++){
        for(int j=0;j<3;j++){
            MatrixThread::RowCol* data = new(MatrixThread::RowCol) ;
            data->row = matrizA[i];
            data->col = matrizB[j];
            data->size=3;
            MatrixThread* mt = new MatrixThread;
            mt->start(data);
            threads.push_back(mt);
            datavector.push_back(data);
        }
    }


    for(int i=0;i<threads.size();i++){
        if (i%3 == 0) cout << endl;
        cout << "\t" << threads[i]->join() << " ";
        delete threads[i];
    }

    cout << endl;

    for (int i=0; i<datavector.size();i++){
        delete datavector[i];
    }

    return 0;



}
